SECTION .text
	BITS 32

get_mm_map:			;e820
	xor ebx, ebx
	
.loop:
	mov eax, 0xe820
	mov dx, ds
	mov es, dx
	mov dx, [buffsize]
	add dx, buff
	mov di, dx
	mov ecx, 20
	mov edx, 'SMAP'

	int 0x15

	jc get_mm_map2		;如果 CF 设置，则不支持该功能，直接进入保护模式
	add [buffsize], dword 20
	test ebx, ebx
	jnz .loop

get_mm_map2:
	mov ax, 0xe801
	int 0x15
	jc protected
	mov [buffsize], word 1
	mov [buff], ax
	mov [buff+2], bx
	mov [buff+4], cx
	mov [buff+6], dx



SECTION .data
GLOBAL buffsize
GLOBAL buff
buffsize:
	dw   0
buff:
	resb 200